package com.gitee.mp.infra.constants;

import com.gitee.mp.core.mapper.MilvusMapper;
import com.gitee.mp.domain.condition.ConditionBuilder;
import com.gitee.mp.infra.struct.SerializableFunction;
import com.gitee.mp.infra.utils.SerializableLambdaUtils;

import java.util.List;

/**
 * @author hongda.li
 */
public final class MilvusPlusConstants {
    /**
     * 默认连接器 ID
     */
    public static final String DEFAULT_ID = "defaultConnector";

    /**
     * 索引后缀
     */
    public static final String INDEX_SUFFIX = "_index";

    /**
     * 条件拼接模板
     */
    public static final String CONDITION_TEMPLATE = "%s %s %s";

    /**
     * 内置 ID 名称
     */
    public static final String FIELD_ID_NAME = "__id";

    /**
     * 内置距离名称
     */
    public static final String FIELD_DISTANCE_NAME = "__distance";

    private MilvusPlusConstants() {
    }

    public static final class MethodName {
        /**
         * equals 方法名称
         */
        public static final String METHOD_EQUALS = "equals";
        /**
         * toString 方法名称
         */
        public static final String METHOD_TO_STRING = "toString";
        /**
         * hashCode 方法名称
         */
        public static final String METHOD_HASH_CODE = "hashCode";

        /**
         * batchInsert
         */
        public static final String METHOD_BATCH_INSERT = SerializableLambdaUtils.parseMethodName(
                (SerializableFunction<MilvusMapper<Object>, List<Object>, Long>) MilvusMapper::batchInsert
        );

        /**
         * batchUpsert
         */
        public static final String METHOD_BATCH_UPSERT = SerializableLambdaUtils.parseMethodName(
                (SerializableFunction<MilvusMapper<Object>, List<Object>, Long>) MilvusMapper::batchUpsert
        );

        /**
         * batchDelete
         */
        public static final String METHOD_BATCH_DELETE = SerializableLambdaUtils.parseMethodName(
                (SerializableFunction<MilvusMapper<Object>, List<Object>, Long>) MilvusMapper::batchDelete
        );

        /**
         * select
         */
        public static final String METHOD_SELECT = SerializableLambdaUtils.parseMethodName(
                (SerializableFunction<MilvusMapper<Object>, ConditionBuilder<Object>, List<Object>>) MilvusMapper::select
        );

        private MethodName() {
        }
    }
}
